﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DTO;
using BUS;
namespace MasterPageGroupF3
{
    public partial class comment : System.Web.UI.Page
    {
 


        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            if (Session["UserName"] != null)
            {
                string contentComment = TextBox3.Text;
                string username = Session["UserName"].ToString();
                int product = int.Parse(Request.QueryString["IDProduct"].ToString());
                DateTime d = DateTime.Now;
                COMMENT cm = new COMMENT();
                cm.IDPRODUCT = product;
                cm.TIME = d;
                cm.USERNAME = username;
                cm.CONTENT = contentComment;
                COMMENTBUS.Add_Comment(cm);
                Response.Redirect("comment.aspx?IDProduct=" + product);
            }
            else
            {
                Response.Write("<script language='javascript'>alert('Bạn phải đăng nhập để comment.');</script>");
            }
        }

       
    }
}